from src.admin.Admin_UI import Ui_MainWindow
from PyQt5 import QtWidgets
from src.admin.FineMag_win import FineMag_Win
from src.admin.SelectToy_win import SelectToy_Win
from src.admin.SelectUser_win import SelectUser_Win
from src.admin.LR_win import LR_Win
from src.admin.Relat_win import Relat_Win
from src.admin.SelectKind_win import SelectKind_Win
from src.admin.AllFineK_win import AllFineK_Win
from src.admin.AllL_win import AllL_Win
import mysql.connector

class AdminUI_Win(QtWidgets.QMainWindow,Ui_MainWindow):
    def __init__(self, mydb,parent=None):
        super(AdminUI_Win, self).__init__(parent=parent)
        #ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('')
        #self.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
        #self.setWindowIcon(icon)
        self.setupUi(self)
        self.LoginSignal=False
        self.mydb=mydb


        self.FineMag_form=FineMag_Win(self.mydb)
        self.SelectToy_form=SelectToy_Win(self.mydb)
        self.SelectUser_form=SelectUser_Win(self.mydb)
        self.LR_form=LR_Win(self.mydb)
        self.Relat_form=Relat_Win(self.mydb)
        self.SelectKind_form=SelectKind_Win(self.mydb)
        self.AllFineK_form=AllFineK_Win(self.mydb)
        self.AllL_form=AllL_Win(self.mydb)

        self.FineMag_form.setWindowTitle("罚款管理")
        self.SelectToy_form.setWindowTitle("玩具个体查询")
        self.SelectUser_form.setWindowTitle("会员信息查询")
        self.LR_form.setWindowTitle("玩具租借管理")
        self.Relat_form.setWindowTitle("续租登记")
        self.AllFineK_form.setWindowTitle("罚款种类管理")
        self.SelectKind_form.setWindowTitle("玩具种类管理")
        self.AllL_form.setWindowTitle("全部租借记录")

    def myFineMag(self):
        self.FineMag_form.show()

    def myToySelect(self):
        self.SelectToy_form.show()

    def myUserSelect(self):
        self.SelectUser_form.show()

    def myLR(self):
        self.LR_form.show()

    def myRelat(self):
        self.Relat_form.show()

    def myKindSelect(self):
        self.SelectKind_form.show()

    def getMydb(self,mydb):
        self.mydb=mydb
        self.FineMag_form.getMydb(mydb)
        self.SelectToy_form.getMydb(mydb)
        self.AllL_form.getmydb(mydb)
        self.AllFineK_form.getmydb(mydb)
        self.SelectUser_form.getmydb(mydb)
        self.LR_form.getmydb(mydb)
        self.Relat_form.getmydb(mydb)
        self.SelectKind_form.getmydb(mydb)

    def myAllFineK(self):
        self.AllFineK_form.myTable_init()
        self.AllFineK_form.show()

    def myAllL(self):
        self.AllL_form.myTable_init()
        self.AllL_form.show()


